home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 7
/
Night Owl Shareware (NOPV7)(Night Owl Publisher Inc.)(1992).bin
/
038a
/
bash1_12.arj
/
BASH1-12.TAR
/
bash-1.12
/
examples
/
functions
/
external.~1~
< prev
next >
Wrap
Text File
|
1991-11-11
|
720b
|
20 lines
# Contributed by Noah Friedman.
# To avoid using a function in bash, you can use the `builtin' or
# `command' builtins, but neither guarantees that you use an external
# program instead of a bash builtin if there's a builtin by that name. So
# this function can be used like `command' except that it guarantees the
# program is external by first disabling any builtin by that name. After
# the command is done executing, the state of the builtin is restored.
function external ()
{
local state=$(builtin type -type "$1" 2> /dev/null)
local exit_status
[ "${state}" = "builtin" ] && enable -n "$1"
command "$@"
exit_status=$?
[ "${state}" = "builtin" ] && enable "$1"
return ${exit_status}
}